feat(protect): hardening follow-ups (partial-scan, IPv6 egress, Set-Cookie redaction, WebSocket, verbose-error breadth)#80
Merged
Conversation
Addresses the gaps surfaced reviewing #79: - Body cap → partial-scan (was discard). An oversize body is now TRUNCATED to the cap and its prefix scanned (front-loaded payloads are caught), with memory bounded by a 4× hard ceiling; only a declared body over that ceiling is skipped. Content- Length is compared in bytes; the prefix slice is by char (can only over-scan). - IPv6 host extraction on the node:http egress path. extractHttpTarget no longer mangles `::1` / `[::1]` / `[::1]:port` via split(':') — normalizeHost preserves them so isInternalHost (which strips brackets) blocks IPv6-internal SSRF via options host. - Redact array-valued headers. Header screening now masks multi-valued Set-Cookie (via getSetCookie / node arrays) and re-emits each cookie separately, in both the fetch and node paths. - Multipart parser robustness: tolerate LF-only line endings and collect duplicate field names (arrays), matching the body/urlencoded behavior. - WebSocket egress screening: the guard now also wraps the global WebSocket so ws:// /wss:// egress is screened; restored on uninstall. - Verbose-error breadth: a default response rule redacts multi-language exception/ traceback signatures (Python/JVM/.NET/Go) beyond the node stack-trace + SQL rules. +6 tests (body-cap partial-scan incl. the past-cap residual, IPv6 node egress, Set-Cookie array redaction, multipart LF/dup, WebSocket block, exception redaction, allowHosts override). 443 tests pass, typecheck + build clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Comprehensive security hardening with cohesive, well-tested follow-up enhancements. 🎯 Quality: 100% Elite · 📦 Size: Medium 📈 This month: Your 32nd PR — above team average · Averaging Excellent |
Contributor
Author
|
/review |
mariojgt
approved these changes
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-ups from the security review of #79 (now merged) — closes the gaps that review surfaced.
extractHttpTargetno longer mangles::1/[::1]/[::1]:portviasplit(':');normalizeHostpreserves them soisInternalHostblocks IPv6-internal SSRF passed as an optionshost/hostname.Set-Cookie(viagetSetCookie()/ node arrays) and re-emits each cookie separately (fetch + node paths).WebSocketsows:///wss://egress is screened; restored on uninstall.Deferred (noted, not done): DNS-rebinding resistance for egress (needs async resolve that doesn't fit the sync
http.requestwrapper).Tests (+6)
fetch-body-cap,egress-followups,multipart,response-hardening. 443 pass, typecheck + build clean.🤖 Generated with Claude Code